<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2023/4/10
  Time: 10:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<body>
<head>
  <title>主页</title>
</head>
<%
  //获取session值
  String str = (String)session.getAttribute("username");
  //如果为空，就是未登录的状态
  if(str == null)
  {
%>
<form action="login" name="login" id="login" method="post">
  <input id="username" type="text" name="username" placeholder="请输入账号"></br>
  <p> </p>
  <input id="password" type="password" name="password" placeholder="请输入密码">
  <p> </p>
  <input type="submit" id="dl" name="dl" value="登录"></br>
</form>
<%
  }
%>
<%
  //如果是登录的状态
  if (str != null)
  {

%>
用户名：<%=session.getAttribute("username")%>
<form action="loginout.jsp" name="loginout" id="loginout" method="post">
  <input id="zx" type="submit" name="zx" value="注销">
</form>
<%
  }
%>
</body>
</html>
